import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/Home.vue'
import Todo from '@/views/todovant/Todo.vue'
import Test from '@/views/test.vue'
Vue.use(Router)

export default new Router({
	// mode: 'history',
	base: process.env.BASE_URL,
	routes: [{
			path: '/test',
			name: 'test',
			component: Test
		},
		{
			path: '/',
			name: 'home',
			component: Home
		},
		{
			path: '/about',
			name: 'about',
			// route level code-splitting
			// this generates a separate chunk (about.[hash].js) for this route
			// which is lazy-loaded when the route is visited.
			component: () => import( /* webpackChunkName: "about" */ '@/views/About.vue')
		},
		{
			path: '/todo',
			name: 'todo',
			component: () => import( /* webpackChunkName: "todo" */ '@/views/todovant/Todo.vue')
			// component : Todo,
		},
		{
			path: '/login',
			name: 'login',
			component: () => import( /* webpackChunkName: "login" */ '@/views/login/Login.vue')
			// component : Todo,
		},

		{ //商品列表
			path: "/product/list",
			name: "productList",
			component: () => import( /* webpackChunkName: "product" */ '@/views/product/ProductList.vue')
		},
		// { // 商品详情
		// 	path: "/product/detail/:id", 
		// 	name: "productDetail",
		// 	props:true,
		// 	component: () => import( /* webpackChunkName: "product" */ '@/views/product/ProductDetail.vue')
		// },
		{ // 商品详情
			path: "/product/detail", 
			name: "productDetail",			
			component: () => import( /* webpackChunkName: "product" */ '@/views/product/ProductDetail.vue')
		},


		//要放在最后
		{ // 不存在提示
			path: "*",
			name: "notFound",
			component: () => import( /* webpackChunkName: "notfound" */ '@/views/NotFound.vue')

		},

	]
})
